package com.ruoyi.training.mapper;

import com.ruoyi.examination.domain.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ExaminationControlMapper {

    /**
     * 通过试卷配置id查询试卷配置信息
     * @param s
     * @return
     */
    public PaperConfig selectPaperConfigByPaperConfigId(String s);

    /**
     * 通过试卷配置id查询试卷
     * @param paperConfigId
     * @return
     */
    public List<ExamPaper> selectExamPaperByPaperConfigId(String paperConfigId);

    /**
     * 获取试卷中的问题
     * @param examPaperId
     * @return
     */
    public List<PaperQuestionRelation> selectPaperQuestionRelationByPaperId(String examPaperId);

    /**
     * 通过问题id查询问题
     * @param questionId
     * @return
     */
    public Question selectQuestionByQuestionId(String questionId);

    /**
     * 查询问题选项
     * @param questionId
     * @return
     */
    public List<QuestionOption> selectQuestionOptionByQuestionId(String questionId);

    /**
     * 通过题组id查询题组信息
     * @param groupId
     * @return
     */
    public QuestionGroup selectQuestionGroupByGroupId(String groupId);

    /**
     * 通过试卷id查询试卷信息
     * @param examPaperId
     * @return
     */
    public ExamPaper selectExamPaperByExamPaperId(String examPaperId);

    /**
     * 通过试卷配置id查询题组信息
     * @param paperConfigId
     * @return
     */
    public List<PaperConfigGroup> selectPaperConfigGroupByPaperConfigId(String paperConfigId);

    /**
     * 添加答题记录
     * @param answerRecord
     * @return
     */
    public int insertAnswerRecord(AnswerRecord answerRecord);

    /**
     * 根据组id查询组内所有试题
     * @param relateGroupId
     * @return
     */
    public List<QuestionGroupRelation> selectQuestionGroupRelationByGroupId(String relateGroupId);

    /**
     * 根据问题id查询问题
     * @param questionIds
     * @return
     *  */
    public List<Question> selectQuestionsByIds(@Param("questionIds") List<String> questionIds);

    /**
     * 批量添加答题记录
     * @param answerRecords
     * @return
     */
    public int insertAnswerRecordBatch(List<AnswerRecord> answerRecords);

    /**
     * 添加考试记录
     * @param examRecord
     * @return
     *  */
    public int insertExamRecord(ExamRecord examRecord);

    /**
     * 通过班级id和学生id查询考试记录
     * @param trainingClassId
     * @param studentId
     * @return
     *  */
    public ExamRecord selectExamRecordByCondition(@Param("trainingClassId") String trainingClassId, @Param("studentId") String studentId);

    /**
     * 修改考试记录
     *
     * @param examRecord 考试记录
     * @return 结果
     */
    public int updateExamRecord(ExamRecord examRecord);

    /**
     * 查询考试记录
     *
     * @param trainingClassId 考试记录ID
     * @param studentId 考试记录ID
     * @return 考试记录
     */
    public List<ExamRecord> selectFailedExamRecords(@Param("trainingClassId") String trainingClassId, @Param("studentId") String studentId);

    /**
     * 批量插入试卷题组关系
     * @param relations
     * @return
     */
    public int batchInsertRelation(List<PaperQuestionRelation> relations);

    /**
     * 批量插入试卷
     * @param examPaper
     * @return
     */
    public int insertExamPaper(ExamPaper examPaper);

    /**
     * 查询班级下的试卷信息
     * @param examPaperVo
     * @return
     */
    public List<ExamPaper> selectExamPaperList(ExamPaper examPaperVo);

    /**
     * 通过班级id和学生id查询考试记录
     * @param trainingClassId
     * @param studentId
     * @return
     */
    public List<ExamRecord> selectExamRecordByTrainingClassIdAndStudentId(@Param("trainingClassId") String trainingClassId, @Param("studentId") String studentId);
}
